package com.ruoyi.service.account.enums.platform;

import com.ruoyi.common.core.enums.IOFlagEnum;
import lombok.Getter;

/**
 * <p>
 * 作用：变动类型
 * </p>
 *
 * @author Zane
 * @since 2025-10-05 21:15
 */
@Getter
public enum PlatformChangeTypeEnum {
  /**
   * 公司充值；
   */
  COM_YC("COM_YC", "预存", IOFlagEnum.IN, "公司账户预存");
  /**
   * 编码
   */
  private final String code;

  /**
   * 输入输出标识  入账 1, 出账 -1
   */
  private final IOFlagEnum ioFlag;
  /**
   * 名称
   */
  private final String name;
  /**
   * 描述
   */
  private final String desc;

  PlatformChangeTypeEnum(String code, String name, IOFlagEnum ioFlag,String desc) {
    this.code = code;
    this.name = name;
    this.ioFlag = ioFlag;
    this.desc = desc;
  }

  public boolean eqCode(String code) {
    return this.code.equals(code);
  }

  public static PlatformChangeTypeEnum valueOfCode(String changeType) {
    for (PlatformChangeTypeEnum value : PlatformChangeTypeEnum.values()) {
      if (value.eqCode(changeType)) {
        return value;
      }
    }
    throw new IllegalArgumentException("变动类型不存在");
  }
}
